﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using GD.ModelContest.Model;
using GD.ModelContest.Service;
using GD.ModelContest.Common;

namespace GD.ModelContest.Web.Admin
{
    public partial class AddUser : BaseCheckPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void lkbAdd_Click(object sender, EventArgs e)
        {
            mc_admin admin = new mc_admin();
            admin.adminName = this.txtLoginName.Text.Trim();
            admin.password = this.txtPassWord.Text.Trim();
            admin.lastLoginIp = Request.UserHostAddress.ToString();
            admin.lastLoginTime = DateTime.Now;
            admin.status = 0;

            if (ServiceLocator.IAdminService.InsertAdmin(admin))
            {
                JavaScript.Alert("恭喜您！添加成功！", this.Page);
                return;
            }
            else
            {
                JavaScript.Alert("对不起！添加失败！", this.Page);
                return;
            }
        }
    }
}
